package com.etlmaster.datax.plugins.writer.rationaldbwriter;

import java.util.ArrayList;
import java.util.List;
import com.dp.nebula.wormhole.common.AbstractSplitter;
import com.dp.nebula.wormhole.common.interfaces.IParam;

public class RationalDbSplitter extends AbstractSplitter {
	private int concurrency = 5;

	@Override
	public void init(IParam jobParams){
		super.init(jobParams);
		concurrency = param.getIntValue(ParamKey.concurrency, this.concurrency);
	}
	
	
	@Override
	public List<IParam> split(){
		List<IParam> v = new ArrayList<IParam>();
		if (1 == concurrency){
			v.add(param);
		}else{
			for (int i = 0; i < concurrency; i++) {
				IParam oParams = param.clone();
				v.add(oParams);
			}
		}		
		return v;
	}


}
